{extend name="layout/layout" /}

{block name="pagecss"}
<style>
	table.dataTable.no-footer {
		border-bottom: 0 !important;
	}
	#data-table_processing {
		border: 0 !important;
		position: relative;
	}
</style>
<link href="__STATIC__/admin/pages/css/article.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/plugins/umeditor/umeditor.min.css" rel="stylesheet" type="text/css" />
{/block}

{block name="content"}
<div class="row js-check-wrap">
	<div class="col-lg-12">
		<div class="box box-success">
			<div class="box-header with-border">
				<div class="row">
					<div class="col-md-9">
						<form id="searchForm" class="relative row">
							<div class="grid-btn" id="search">
								<div class="col-md-5">
									<select name="search" class="form-control ">
										<option value="0">文章排序</option>
										<option value="1"><span>最新发布</span></option>
										<option value="2"><span>最多预览</span></option>
										<option value="3"><span>首页推荐</span></option>
									</select>
								</div>
							</div>
						</form>
					</div>
				</div>
				<div class="box-tools pull-right">
					<button class="btn btn-primary btn-sm" id="btn_new_article"><i class="fa fa-plus"></i> 发布文章</button>
				</div>
			</div>
			<div class="box-body">
				<form id="sort_input" class="js-ajax-form">
					<div style="height: 40px">
						<button type="button" id="button_sort" class="btn bg-navy">排序</button>
					</div>
					<table class="table table-striped table-bordered table-hover table-checkable order-column" id="table_article">
						<thead>
						<tr>
							<th>排序</th>
							<th>缩略图</th>
							<th>标题</th>
							<th>创建时间</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
				</form>
			</div>
		</div>
	</div>
</div>
{/block}

{block name="pagescript"}
<script>
    var index_list = "{:url('admin/article/indexApi')}";  //查询文章列表
    var sort_url = "{:url('admin/article/sort')}";  //排序地址
    var edit_url = "{:url('admin/article/edit')}";  //编辑地址
    var add_url = "{:url('admin/article/add')}";  //添加地址
    var del_url = "{:url('admin/article/delete')}";  //删除文章

    var commend_url = "{:url('admin/article/recommend')}";  //首页推荐

    function commend(id) {
        $.ajax({
            url :"{:url('admin/article/recommend')}",
            type : 'POST',
            dataType : 'json',
            contentType:"application/json; charset=utf-8",
            data : JSON.stringify({'id':id}),
        }).done(function(data) {
            if(data.code === '2') {
                alert(data.message);
                window.location.reload();
            }
            window.location.reload();
        });
    }
</script>
<script src="__STATIC__/admin/js/include.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/article.js" type="text/javascript"></script>
{/block}